package com.commerce.user.feign;

import com.commerce.common.entity.Product;
import com.commerce.common.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 产品服务Feign客户端
 */
@FeignClient(name = "commerce-product-service")
public interface ProductFeignClient {

    /**
     * 根据ID获取商品详情
     */
    @GetMapping("/api/products/{id}")
    Result<Product> getProductById(@PathVariable("id") Long id);

    /**
     * 批量获取商品信息
     */
    @GetMapping("/api/products/batch")
    Result<List<Product>> getProductsByIds(@RequestParam("ids") List<Long> ids);
}
